
import { Database } from 'bun:sqlite'
import Datastore from 'nedb-promises'

const CreateDatabase2 = (appName: string, moduleName: string, databaseName: string) => {
  new Database(`./database/${appName}/${moduleName}/${databaseName}.db`, { create: true })
}

const CreateDatabase = (appName: string, moduleName: string, databaseName: string) => {
  // new Database(`../../database/${appName}/${moduleName}/${databaseName}`, { create: true })
  return Datastore.create(`./database/${appName}/${moduleName}/${databaseName}.db`)
}

const SelectDatabase = (appName: string, moduleName: string, databaseName: string) => {
  console.log('use database', `./database/${appName}/${moduleName}/${databaseName}.db`)
  return Datastore.create(`./database/${appName}/${moduleName}/${databaseName}.db`)
}


export { CreateDatabase, SelectDatabase }
